package com.example.ddnfantasy

import android.Manifest
import android.content.Intent
import android.os.Bundle
import android.util.Log
import com.ddn.fantasy.R
import com.example.baseutils.activity.BaseActivity
import com.example.baseutils.initSharedPrefer
import com.example.baseutils.start
import com.example.fantacylib.FantacyMain
import com.example.printlib.MainActivity
import com.example.printlib.PrintMainActivity


class SplashActivity : BaseActivity() {
    private val TAG = "SplashActivity"
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        Log.i(TAG, "onCreate: ")
        setContentView(R.layout.activity_splash)
    }

    override fun onStart() {
        super.onStart()
        Log.i(TAG, "onStart！ ")

        requestPermision(
            this,
            Manifest.permission.WRITE_EXTERNAL_STORAGE,
            Manifest.permission.READ_EXTERNAL_STORAGE,
            Manifest.permission.READ_PHONE_STATE,
            Manifest.permission.CAMERA,
            Manifest.permission.RECORD_AUDIO
        )
    }

    override fun gotPermision() {
        super.gotPermision()
        Log.i(TAG, "gotPermision: ")
        initSharedPrefer(application, "DdnFantasy")
        FantacyMain().start(this)
        finish()
    }

    /**
     * 经过资源加载后，进入游戏界面
     * */
    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
//        WaitActivity().start(this)
        Log.e(TAG, "onActivityResult: ")
    }

}
